home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / src / portable kernel / mac / mmu.h < prev    next >
Encoding:
Text File  |  1994-10-25  |  2.3 KB  |  116 lines  |  [TEXT/KAHL]

  1. typedef unsigned int    PhysicalAddress;
  2. typedef unsigned int    Word;
  3.  
  4. typedef struct {
  5.     unsigned int    lu:1;
  6.     unsigned int    limit:15;
  7.     unsigned int    :14;
  8.     unsigned int    dt:2;
  9.     unsigned int    addr:28;
  10.     unsigned int    :4;
  11. } RootPointerRegister;
  12.  
  13. #define LU_UPPER    0
  14. #define LU_LOWER    1
  15.  
  16. #define DT_INVALID    0
  17. #define DT_PAGE        1
  18. #define DT_VALID_4    2
  19. #define DT_VALID_8    3
  20.  
  21. typedef struct {
  22.     unsigned int    enable:1;
  23.     unsigned int    :5;
  24.     unsigned int    sre:1;
  25.     unsigned int    fcl:1;
  26.     unsigned int    ps:4;
  27.     unsigned int    is:4;
  28.     unsigned int    tia:4;
  29.     unsigned int    tib:4;
  30.     unsigned int    tic:4;
  31.     unsigned int    tid:4;
  32. } TranslationControlRegister;
  33.  
  34. #define PS_256    0x8
  35. #define PS_512    0x9
  36. #define PS_1K    0xa
  37. #define PS_2K    0xb
  38. #define PS_4K    0xc
  39. #define PS_8K    0xd
  40. #define PS_16K    0xe
  41. #define PS_32K    0xf
  42.  
  43. typedef struct {
  44.     unsigned int    lba:8;
  45.     unsigned int    lam:8;
  46.     unsigned int    enable:1;
  47.     unsigned int    :4;
  48.     unsigned int    ci:1;
  49.     unsigned int    rw:1;
  50.     unsigned int    rwm:1;
  51.     unsigned int    :1;
  52.     unsigned int    fcbase:3;
  53.     unsigned int    :1;
  54.     unsigned int    fcmask:3;
  55. } TransparentTranslationRegister;
  56.  
  57. typedef struct {
  58.     unsigned int    addr:28;
  59.     unsigned int    u:1;
  60.     unsigned int    wp:1;
  61.     unsigned int    dt:2;
  62. } ShortTableDescriptor;
  63.  
  64. typedef struct {
  65.     unsigned int    addr:24;
  66.     unsigned int    :1;
  67.     unsigned int    ci:1;
  68.     unsigned int    :1;
  69.     unsigned int    m:1;
  70.     unsigned int    u:1;
  71.     unsigned int    wp:1;
  72.     unsigned int    dt:2;
  73. } ShortPageDescriptor;
  74.  
  75. typedef struct {
  76.     unsigned int    lu:1;
  77.     unsigned int    limit:15;
  78.     unsigned int    :7;
  79.     unsigned int    s:1;
  80.     unsigned int    :4;
  81.     unsigned int    u:1;
  82.     unsigned int    wp:1;
  83.     unsigned int    dt:2;
  84.     unsigned int    addr:28;
  85.     unsigned int    :4;
  86. } LongTableDescriptor;
  87.  
  88. typedef struct {
  89.     unsigned int    :23;
  90.     unsigned int    s:1;
  91.     unsigned int    :1;
  92.     unsigned int    ci:1;
  93.     unsigned int    :1;
  94.     unsigned int    m:1;
  95.     unsigned int    u:1;
  96.     unsigned int    wp:1;
  97.     unsigned int    dt:2;
  98.     unsigned int    addr:24;
  99.     unsigned int    :8;
  100. } LongPageDescriptor;
  101.  
  102. void    GetTC(TranslationControlRegister *);
  103. void    GetTT0(TransparentTranslationRegister *);
  104. void    GetTT1(TransparentTranslationRegister *);
  105. void    SetTT0(TransparentTranslationRegister *);
  106. void    SetTT1(TransparentTranslationRegister *);
  107. void    GetCRP(RootPointerRegister *);
  108. void    GetSRP(RootPointerRegister *);
  109. int    GetSFC(void);
  110. int    GetDFC(void);
  111. void    SetSFC(int);
  112. void    SetDFC(int);
  113.  
  114. unsigned int    ReadPhysicalWords(PhysicalAddress pa, Word *buf, int nWords);
  115. unsigned int    WritePhysicalWords(PhysicalAddress pa, Word *buf, int nWords);
  116.